import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { loadEnv } from 'vite';
import path from 'path';
// https://vitejs.dev/config/
export default ({ mode })=>{
  const env = loadEnv(mode, process.cwd());
  const {VITE_PORT,VITE_APP_HOST} =env;
  return defineConfig({
    server: {
      port:~~VITE_PORT,
      host: VITE_APP_HOST,
    },
    resolve: {
      alias: {
        '@': path.resolve(__dirname, './src')
      },
      extensions: ['.js', '.ts', '.json', '.jsx','.tsx'] // 导入时想要省略的扩展名列表
    },
    plugins: [react()],
  })
}
